<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台</title>
<link rel="stylesheet" type="text/css" href="css/css.css"/>
<script src="js/jQuery.js" type="text/javascript"></script>
<script>
    $(function(){
    	$("#img1").bind("click",changeImage);
    });
    
    function changeImage(){
    	var sr=$("#img1").attr("src");
    		$("#img1").attr("src",sr+'?');
    }
</script>
</head>
<?php
     //phpinfo();
     session_start();
	 require_once "backManager/User.php";
	 if(isset($_POST['submited'])){
	 	 $name=$_POST['name'];
		 $pwd=$_POST['pwd'];
		 $checkNum=$_POST['checkNum'];
		 $sesCheckNum=$_SESSION["Checknum"];
		 if($checkNum!=$sesCheckNum){
		     header("location:login.php");
			 exit;
		 }
	     $user=User::getUserByNameAndPwd($name,$pwd);
		 //$user->__set("name","gaokang");
		 //echo $user->showMsg("name");exit;
		 if($user){
			$_SESSION['username']=$user->getName();
			$_SESSION['userid']=$user->getId();
			header("location:index.php");
		 }else{
		 	header("location:login.php");
		 }
	 }	 
	 
?>
<div class="top"><!--top start-->
	<div class="topLeft"><!--topRight start-->
    　      <span>喜迎中国共产党第十八次代表大会！</span>
    </div><!--topLeft end-->
    <div class="topRight"><!--topRight start-->
       <span><?php echo $showtime=date("Y-m-d H:i:s"); ?>&nbsp;&nbsp;&nbsp;&nbsp;</span>
    </div><!--topRight end-->
</div><!--top end-->
<form action="" method="POST">
	<table width="500" align="center">
	   <tr>
	   	  <td>用户名:</td>
	   	  <td><input type="text" name="name" size="30"/></td>
	   </tr>
	   <tr>
	   	  <td>密&nbsp;&nbsp;&nbsp;码:</td>
	   	  <td><input type="password" name="pwd" size="31" /></td>
	   </tr>
	   <tr>
	   	  <td>验证码:</td>
	   	  <td>
	   	  	  <input type="text" name="checkNum" siz="6" maxlength="4">&nbsp;
	   	  	  <img id="img1" src="imgCode.php" style="cursor:pointer" alt="点击刷新" />
	   	  	  <a href="javascript:changeImage();">看不清</a>
	   	  </td>
	   </tr>
	   <tr align="center">
	   	  <td colspan="2"><input type="submit" name="submited" value="登陆"/></td>
	   </tr>
	</table>
</form>